package com.gxsyh.nantie.phone.provider.service;

import javax.annotation.Resource;

import com.gxsyh.nantie.phone.provider.api.domain.TbHomeImg;
import com.gxsyh.nantie.phone.provider.mapper.TbHomeImgMapper;
import com.gxsyh.nantie.phone.provider.api.TbHomeImgService;
import org.apache.dubbo.config.annotation.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @email yom535@outlook.com
 * @author: 刘锋嘉(Liu Fengjia)
 * @date: 2020/1/20
 * @time: 09:53
 * @Description: 
 */
@Service(version = "1.0.0")
public class TbHomeImgServiceImpl implements TbHomeImgService{

    @Resource
    private TbHomeImgMapper tbHomeImgMapper;

    @Override
    public int updateImage(Long id, String image) {
        Example example=new Example(TbHomeImg.class);
        example.createCriteria().andEqualTo("id",id);
        TbHomeImg tbHomeImg=new TbHomeImg();
        tbHomeImg.setImage(image);
        return tbHomeImgMapper.updateByExampleSelective(tbHomeImg,example);
    }

    @Override
    public List<TbHomeImg> getHomeImgAll() {
        return tbHomeImgMapper.selectAll();
    }
}
